<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script type="text/javascript">
    var margintop = $("#header").offset().top

    //var marginleft = $("#header_cont").offset().left;
    //alert(margintop)
    //alert(marginleft)

    $(window).scroll(function() {
        var scrtop = $(document).scrollTop();
        if(scrtop<margintop){
            $('#header').css({
                position: 'absolute',
                top: margintop,
                left:'0'
            });

            return false;
        }
        $('#header').css({
            position: 'absolute',
            top: scrtop,
            left:'0'
        });
    });
</script>